//
//  AppDelegate.m
//  FruitsWholesaler
//
//  Created by sgone-2 on 15/11/12.
//  Copyright © 2015年 sgone. All rights reserved.
//

#import "AppDelegate.h"
#import "Common.h"
#import "MyMainViewController.h"
//加载友盟SDK统计分析
#import "MobClick.h"

//友盟反馈
#import "UMFeedback.h"
#import "UMOpus.h"
#import "IQKeyboardManager.h"


#import "DataSingleton.h"
@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  
  
    
    
    
    
    //创建window
    self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen] bounds]];

    
    
    MyMainViewController *ma = [[MyMainViewController alloc]init];
    self.window.rootViewController = ma;
    self.window.backgroundColor = [UIColor whiteColor];
    
    
    //注册友盟分享SDK,启动时加载数据操作
    
    [MobClick startWithAppkey:youmengSecrect reportPolicy:BATCH   channelId:nil];
    
    
//    以App打包时的Build号作为应用程序的版本标识，不能通过友盟SDK或友盟后台配置。
//    
//    友盟SDK为了兼容Xcode3的工程，默认取的是Build号，如果需要取Xcode4及以上版本的Version，可以使用下面的方法；
    NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
    [MobClick setAppVersion:version];
    
    
    //使用自有账号进行登录,进行统计
    DataSingleton *dh = [DataSingleton sharedDataSingleton];
    NSString *playerID = [NSString stringWithFormat:@"%@",dh.phone];
    [MobClick profileSignInWithPUID:playerID];
    
    
    
    
    //友盟反馈
    [UMFeedback setAppkey:youmengSecrect];
    //语音输入
    [UMOpus setAudioEnable:YES];

    
    
    
    
    
    
    
    
    if (IOS_VERSION >= 7.0) {
        [UITabBar appearance].barTintColor = [UIColor whiteColor];
        [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
        [UINavigationBar appearance].barTintColor = [UIColor grayColor];
        [UINavigationBar appearance].tintColor = [UIColor whiteColor];
        [[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObject:[UIColor blackColor] forKey:UITextAttributeTextColor]];
        
    } else {
        [UINavigationBar appearance].tintColor = [UIColor whiteColor];
    }
    
    
    [self.window makeKeyAndVisible];
    
    IQKeyboardManager *manager = [IQKeyboardManager sharedManager];
    manager.enable = YES;
    manager.shouldResignOnTouchOutside = YES;
    manager.shouldToolbarUsesTextFieldTintColor = YES;
    manager.enableAutoToolbar = NO;
    
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application {

}

- (void)applicationDidEnterBackground:(UIApplication *)application {
    
}

- (void)applicationWillEnterForeground:(UIApplication *)application {

}

- (void)applicationDidBecomeActive:(UIApplication *)application {

}

- (void)applicationWillTerminate:(UIApplication *)application {
 
}

@end
